<template>
	<scroll-view scroll-y="true" class="main">
		<view class="orderleveltop">
			<image src="../../static/pages_order/bg.png" class="bg" mode=""></image>
			<u-navbar title="服务升级" :fixed='false' :border='false' bgColor="rgbg(0,0,0,0)" leftIconColor='#fff' :autoBack="true" titleStyle="color:#fff;"></u-navbar>
			<view class="u-m-t-50 white u-font-bold u-font-30">当前服务项目：</view>
			<view class="levellist" >
				<view class="levellist_item flex" >
					<image class="project" :src="$oss(cate.image)" mode=""></image>
					<view class="levellist_item_middle flex">
						<text class="u-font-30">{{cate.name}}</text>
						<view class="flex">
							<view class="tips u-font-24">
								{{cate.intro}}
							</view>
						</view>
						<view class="price">
							<text class="u-font-24">¥</text>
							 <text class="u-font-34 u-font-bold"> {{cate.price}}</text>
						</view>
					</view>
					<view class="levellist_item_right_top flex">
						<image src="/static/pages_order/time.png" mode=""></image>
						<text class="u-font-28">{{cate.costmin}}分钟</text>
					</view>

				</view>
			</view>
		</view>
		<view class="levellist u-m-tb-50">
			<view class="  u-font-bold u-font-30">可升级为以下项目：</view>
			<view class="levellist_item flex" v-for="item in list" v-if="Number(item.price) > Number(cate.price)">
				<image class="project" :src="$oss(item.image)" mode=""></image>
				<view class="levellist_item_middle flex">
					<text class="u-font-30">{{item.name}}</text>
					<view class="flex">
						<view class="tips u-font-24">
							{{item.intro}}
						</view>
					</view>
					<view class="price">
						<text class="u-font-24">¥</text>
						 <text class="u-font-34 u-font-bold"> {{item.price}}</text>
					</view>
				</view>
				<view class="levellist_item_right_top flex">
					<image src="/static/pages_order/time.png" mode=""></image>
					<text class="u-font-28">{{item.costmin}}分钟</text>
				</view>
				<view class="sjbtn white flex u-font-26" @click="uppay(item)">
					立即升级
				</view>
			</view>
		</view>
		<u-empty mode="list" v-if="finish && list.length === 0" style="margin-top: 200rpx;" icon="/static/none.png">
				</u-empty>
	</scroll-view>
</template>

<script>
	export default {
		data() {
			return {
				cate: '',
				service_id: '',
				num: '',
				id: '',
				list: [],
				finish:false
			};
		},
		onLoad(option) {
			
			this.cate = JSON.parse(decodeURIComponent(option.cate))
			this.service_id = option.service_id
			this.num = option.num
			this.id = option.id
			this.getInfo()
		},
		methods:{
			uppay(item){
				let money = Number(item.price - this.cate.price).toFixed(2)
				uni.navigateTo({
					url: '/pages_order/orderlevel/payOrder?order_id='+this.id+'&money='+money+ '&cate_id='+item.id+'&num='+this.num+'&name='+item.name
				})
			},
			getInfo(){
				this.$api.post('/getskillinfo', {
					service_id: this.service_id,
					type:3
				}).then(res => {
					if (res.code == 1) {
						this.list = res.data.cateInfo
						if(res.data.cateInfo){
							this.finish = true
						}
					}
				}).catch((res) => {
				
				})
			}
		}
	}
</script>

<style lang="scss">
	.main ::v-deep .u-navbar__content {
	    display: flex;
	    flex-direction: row;
	    align-items: center;
	    height: 44px;
	    background-color: rgba(1, 1, 1, 0) !important;
	    position: relative;
	    justify-content: center;
		color: #fff;
	}
	::v-deep .u-navbar__content__title[data-v-95dec1ae] {
    text-align: center;
    font-size: 16px;
    color: #fff;
}
.main{
	height: 100vh;
	overflow: hidden;
}
.orderleveltop{
	box-sizing: border-box;
	width: 100vw;
	height: 546rpx;
	.bg{
		width: 100%;
		height: 546rpx;
		position: absolute;
		left: 0;
		top: 0;
	}
	.levellist{
		position: relative;
		z-index: 10;
		box-sizing: border-box;
		.levellist_item{
			position: relative;
			margin-top: 50rpx;
			align-items: center;
			background-color: #fff;
			border-radius: 30rpx;
			width: 100%;
			box-sizing: border-box;
			.project{
				width: 195rpx;
				height: 160rpx;
				border-radius: 30rpx 0 30rpx 0;
				margin-right: 20rpx;
			}
			.levellist_item_middle{
				justify-content: space-between;
				flex-direction: column;
				height: 170rpx;
				.tips{
					border: 1rpx solid #8D93A5;
					padding: 5rpx 10rpx;
					border-radius: 20px;
					color: #8D93A5;
					&:nth-child(n+2){
						margin-left: 10rpx;
					}
				}
				.price{
					color: #E91919;
				}
			}
			.levellist_item_right_top{
				position: absolute;
				right: 0;
				top: 20rpx;
				width: 143rpx;
				height: 53rpx;
				background: #EBFBF7;
				border-radius: 100rpx 0rpx 0rpx 100rpx;
				color: $uni-primary;
				text-align: center;
				align-items: center;
				justify-content: space-between;
				padding: 0 20rpx;
				image{
					width: 24rpx;
					height: 25rpx;
				}
			}
			.sjbtn{
				width: 150rpx;
				height: 56rpx;
				background: #00CE9B;
				border-radius: 28rpx;
				line-height: 56rpx;
				justify-content: center;
				margin-top: 100rpx;
				margin-left: 20rpx;
			}
		}
	}
}
.levellist{
	padding: 30rpx;
	.levellist_item{
		position: relative;
		margin-top: 50rpx;
		align-items: center;
		background-color: #fff;
		border-radius: 30rpx;
		padding: 30rpx 0rpx 30rpx 30rpx;
		.project{
			width: 195rpx;
			height: 160rpx;
			border-radius: 30rpx 0 30rpx 0;
			margin-right: 20rpx;
		}
		.levellist_item_middle{
			justify-content: space-between;
			flex-direction: column;
			height: 170rpx;
			.tips{
				border: 1rpx solid #8D93A5;
				padding: 5rpx 10rpx;
				border-radius: 20px;
				color: #8D93A5;
				&:nth-child(n+2){
					margin-left: 10rpx;
				}
			}
			.price{
				color: #E91919;
			}
		}
		.levellist_item_right_top{
			position: absolute;
			right: 0;
			top: 20rpx;
			width: 143rpx;
			height: 53rpx;
			background: #EBFBF7;
			border-radius: 100rpx 0rpx 0rpx 100rpx;
			color: $uni-primary;
			text-align: center;
			align-items: center;
			justify-content: space-between;
			padding: 0 20rpx;
			image{
				width: 24rpx;
				height: 25rpx;
			}
		}
		.sjbtn{
			width: 150rpx;
			height: 56rpx;
			background: #00CE9B;
			border-radius: 28rpx;
			line-height: 56rpx;
			justify-content: center;
			margin-top: 100rpx;
			margin-left: 20rpx;
		}
	}
}
</style>
